package com.itqf.web;

import com.netflix.hystrix.strategy.concurrency.HystrixRequestContext;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

/**
 * @Description:
 * @Company: 千锋互联
 * @Author: 李丽婷
 * @Date: 2020/12/24
 * @Time: 下午2:40
 */
@WebFilter("/*")
public class HystrixRequestContextInitFilter  implements Filter {
    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        //     Request caching is not available. Maybe you need to initialize the HystrixRequestContext
        HystrixRequestContext.initializeContext();//初始化上下文

        filterChain.doFilter(servletRequest,servletResponse);

    }
}
